<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入css文件 -->
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/element-plus@2.3.6-index.css" rel="external nofollow" target="_blank">
    <!-- 引入js文件 -->
    <script src="js/vue@3.3.4.js"></script>
    <script src="js/element-plus@2.3.6.js" rel="external nofollow"></script>
    <script src="js/jquery-3.6.1.js"></script>
    <title>喵了个喵</title>
</head>

<body>

    <div id="view">
        <!-- <button>查看排行榜</button> -->
        <div class="title" style="margin-top: 20px">喵了个喵</div>
        <div class="remaining top-item" v-if="show">
            <img src="./images/1 (3).png" alt="">
            <span>剩余：{{getValidNum()}}</span>
        </div>
        <div class="time top-item" v-if="show">
            <img src="images/1 (1).png" alt="">
            <span>用时：{{time}}</span>
        </div>
        <div class="points top-item" v-if="show">
            <img src="./images/1 (2).png" alt="">
            <span>总分：{{points}}</span>
        </div>
        <div class="rank" style="margin-top:10px ">
            <a href="./views/rank.html" target="_blank">排行榜</a>
        </div>
        <div class="paused" v-if="show">
            <el-select  v-model="n" placeholder="请选择模式（默认为简单）" style="margin-right: 5px">
            <el-option
                    v-for="item in options"
                    :key="item.n"
                    :label="item.label"
                    :value="item.n"
                    @click="choose_style()"
            ></el-option>
            </el-select>
            <el-button :type="started? 'success' : 'warning'" @click="to_paused">

                <span style="margin-left: 5px;">{{started ? '暂停' : '已暂停'}}</span>
            </el-button>
            <el-button type="primary" class="restart" @click="again">
                <span style="margin-left: 5px;">重新开始</span>
            </el-button>
            <el-button type="info" class="restart quit" @click="quit">
                <span style="margin-left: 5px;">退出</span>
            </el-button>

        </div>
        <div class="begin" v-if="!show" >
        <el-button @click="begin()"style="margin-top: 100px;width: 200px;height: 100px">点击开始游戏</el-button>
        </div>
        <div class="table">

            <div class="item" v-for="j,index in itemData" @click="check(j.code, index, j.id)" :style="j.style"
                :id="j.id" :class="j.cls" v-if="show">
                <img :src="imagePre + j.code +'.png'" alt="">
            </div>

        </div>
        <div class="res" v-if="show">
            <div class="res-row">
                <div class="res-item" v-for="item in resData">
                    <img :src="imagePre + item +'.png'" alt="">
                </div>

            </div>
            <div class="res-row abs">
                <div class="res-item res-item-border" v-for="i in 7">
                </div>
            </div>
        </div>

        <!-- 提示游戏结束 -->
        <el-dialog v-model="dialogVisible" title="小提示" width="30%">
            <span>{{text}}</span>
            <div class="statistics" v-if="result && !submitState">
                <div class="form-item">
                    <label for="">用户名：</label>
                    <input type="text" placeholder="请输入你的名字，以统计您的记录" v-model="username">
                </div>
                <div class="form-item">
                    <label for="">难度等级：</label>
                    <input type="text" placeholder="" :value="difficulty_factor" disabled>
                </div>
                <div class="form-item">
                    <label for="">总分：</label>
                    <input type="text" placeholder="" :value="points" disabled>
                </div>
                <div class="form-item form-button">
                    <button @click="submit()">确认</button>
                </div>
            </div>
            <div class="tips" v-if="submitState">
                提交成功
            </div>
            <template #footer v-if="!result || submitState">
                <span class="dialog-footer">
                    <el-button @click="dialogVisible = false" v-if="result">Cancel</el-button>
                    <el-button type="primary" @click="again">{{res? '再来一局' : '重新开始'}}</el-button>
                </span>
            </template>
        </el-dialog>
    </div>
    <script src="js/index.js"></script>
</body>

</html>